/** * 继续执行回调,直到它成功或策略指示我们停止,在这种情况下将执行恢复回调。 * * @see RetryOperations#execute(RetryCallback, RecoveryCallback) * @param retryCallback the {@link RetryCallback} * @param recoveryCallback the {@link RecoveryCallback} * @throws TerminatedRetryException if the retry has been manually terminated by a listener. */ @Override publicfinal <T, E extendsThrowable> T execute(RetryCallback<T, E> retryCallback,RecoveryCallback<T> recoveryCallback)throws E { return doExecute(retryCallback, recoveryCallback, null); }
/** * Retry interceptor bean name to be applied for retryable method. Is mutually * exclusive with other attributes. * @return the retry interceptor bean name */ String interceptor()default"";
/** * Exception types that are retryable. Synonym for includes(). Defaults to empty (and * if excludes is also empty all exceptions are retried). * @return exception types to retry */ Class<? extendsThrowable>[] value() default {};
/** * Exception types that are retryable. Defaults to empty (and if excludes is also * empty all exceptions are retried). * @return exception types to retry */ Class<? extendsThrowable>[] include() default {};
/** * Exception types that are not retryable. Defaults to empty (and if includes is also * empty all exceptions are retried). * @return exception types to retry */ Class<? extendsThrowable>[] exclude() default {};
/** * A unique label for statistics reporting. If not provided the caller may choose to * ignore it, or provide a default. * * @return the label for the statistics */ String label()default"";
/** * Flag to say that the retry is stateful: i.e. exceptions are re-thrown, but the * retry policy is applied with the same policy to subsequent invocations with the * same arguments. If false then retryable exceptions are not re-thrown. * @return true if retry is stateful, default false */ booleanstateful()defaultfalse;
/** * @return the maximum number of attempts (including the first failure), defaults to 3 */ intmaxAttempts()default3;
/** * @return an expression evaluated to the maximum number of attempts (including the first failure), defaults to 3 * Overrides {@link #maxAttempts()}. * @since 1.2 */ String maxAttemptsExpression()default"";
/** * Specify the backoff properties for retrying this operation. The default is a * simple {@link Backoff} specification with no properties - see it's documentation * for defaults. * @return a backoff specification */ Backoff backoff()default@Backoff();
/** * Specify an expression to be evaluated after the {@code SimpleRetryPolicy.canRetry()} * returns true - can be used to conditionally suppress the retry. Only invoked after * an exception is thrown. The root object for the evaluation is the last {@code Throwable}. * Other beans in the context can be referenced. * For example: * <pre class=code> * {@code "message.contains('you can retry this')"}. * </pre> * and * <pre class=code> * {@code "@someBean.shouldRetry(#root)"}. * </pre> * @return the expression. * @since 1.2 */ String exceptionExpression()default""; }
/** * Synonym for {@link #delay()}. * * @return the delay in milliseconds (default 1000) */ longvalue()default1000;
/** * A canonical backoff period. Used as an initial value in the exponential case, and * as a minimum value in the uniform case. * @return the initial or canonical backoff period in milliseconds (default 1000) */ longdelay()default0;
/** * The maximimum wait (in milliseconds) between retries. If less than the * {@link #delay()} then the default of * {@value org.springframework.retry.backoff.ExponentialBackOffPolicy#DEFAULT_MAX_INTERVAL} * is applied. * * @return the maximum delay between retries (default 0 = ignored) */ longmaxDelay()default0;
/** * If positive, then used as a multiplier for generating the next delay for backoff. * * @return a multiplier to use to calculate the next backoff delay (default 0 = * ignored) */ doublemultiplier()default0;
/** * An expression evaluating to the canonical backoff period. Used as an initial value * in the exponential case, and as a minimum value in the uniform case. * Overrides {@link #delay()}. * @return the initial or canonical backoff period in milliseconds. * @since 1.2 */ String delayExpression()default"";
/** <<<<<<< HEAD * An expression evaluating to the maximum wait (in milliseconds) between retries. * If less than the {@link #delay()} then ignored. ======= * An expression evaluating to the maximimum wait (in milliseconds) between retries. * If less than the {@link #delay()} then the default of * {@value org.springframework.retry.backoff.ExponentialBackOffPolicy#DEFAULT_MAX_INTERVAL} * is applied. >>>>>>> Fix @Backoff JavaDocs - maxDelay * Overrides {@link #maxDelay()} * * @return the maximum delay between retries (default 0 = ignored) * @since 1.2 */ String maxDelayExpression()default"";
/** * Evaluates to a vaule used as a multiplier for generating the next delay for backoff. * Overrides {@link #multiplier()}. * * @return a multiplier expression to use to calculate the next backoff delay (default 0 = * ignored) * @since 1.2 */ String multiplierExpression()default"";
/** * In the exponential case ({@link #multiplier()} > 0) set this to true to have the * backoff delays randomized, so that the maximum delay is multiplier times the * previous delay and the distribution is uniform between the two values. * * @return the flag to signal randomization is required (default false) */ booleanrandom()defaultfalse;
/** * Indicate whether subclass-based (CGLIB) proxies are to be created as opposed * to standard Java interface-based proxies. The default is {@code false}. * * @return whether to proxy or not to proxy the class */ booleanproxyTargetClass()defaultfalse;